import { ElMessageBox, ElMessageBoxOptions } from 'element-plus';
const msgboxOptions = {
	confirmButtonText: '确认',
	center: true,
	draggable: true,
	showClose: false,
};
const alertOptions = {
	confirmButtonText: '知道了',
	center: true,
	draggable: true,
	showClose: false,
};
const confirmOptions = {
	confirmButtonText: '确认',
	cancelButtonText: '取消',
	type: 'warning',
	center: true,
	draggable: true,
	showClose: false,
};
const promptOptions = {
	confirmButtonText: '保存',
	cancelButtonText: '取消',
	type: 'warning',
	center: true,
	draggable: true,
	showClose: false,
};
const messageBox = {
	msgbox: (propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(msgboxOptions, propOptions || {});
		return ElMessageBox(myoptions);
	},
	alert: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(alertOptions, propOptions || {});
		return ElMessageBox.alert(message, title, myoptions);
	},
	confirm: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(confirmOptions, propOptions || {});
		return ElMessageBox.confirm(message, title, myoptions);
	},
	prompt: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(promptOptions, propOptions || {});
		return ElMessageBox.prompt(message, title, myoptions);
	},
	success: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(alertOptions, (propOptions || { type: 'success' }) as ElMessageBoxOptions);
		return ElMessageBox.alert(message, title, myoptions);
	},
	info: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(alertOptions, (propOptions || { type: 'info' }) as ElMessageBoxOptions);
		return ElMessageBox.alert(message, title, myoptions);
	},
	warning: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(alertOptions, (propOptions || { type: 'warning' }) as ElMessageBoxOptions);
		return ElMessageBox.alert(message, title, myoptions);
	},
	error: (message: string, title: string, propOptions?: ElMessageBoxOptions) => {
		let myoptions = Object.assign(alertOptions, (propOptions || { type: 'error' }) as ElMessageBoxOptions);
		return ElMessageBox.alert(message, title, myoptions);
	},
};
export default messageBox;
